/**
 * 示例 1：


 输入：[3,4,5,1,2]
 输出：1
 示例 2：


 输入：[2,2,2,0,1]
 输出：0

 */

let arr = [3,1]
// right = 1
// left = 2
// mid = 2
// left = 0

/**
 * @param {number[]} numbers
 * @return {number}
 */
var minArray = function(numbers) {
    let left =0
    let right = numbers.length-1
    while(left<right){
        let mid =parseInt((right + left) / 2);
        if (numbers[mid] < numbers[right]){
            right = mid
        }else if (numbers[mid] > numbers[right]){
            left = mid + 1
        }else {
            right--
        }
    }
    return numbers[left]
};
console.log(minArray(arr))